package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 怡宝
 */
@RestController
@Api(tags = "服务项接口")
@RequestMapping("/member/orders/project")
public class MemberOrdersController {
    @Autowired
    private INursingProjectService iNursingProjectService;

    /**
     * 分页查询护理项目列表
     */
    @ApiOperation("分页查询护理项目列表")
    @GetMapping("/page")
    public TableDataInfo<NursingProject> list(String name, Integer pageNum, Integer pageSize, Integer status) {
        return iNursingProjectService.pageByNameAndStatus(name, pageNum, pageSize, status);
    }

    /**
     * 根据编号查询护理项目信息
     */
    @ApiOperation("根据编号查询护理项目信息")
    @GetMapping("/{id}")
    public R<NursingProject> getInfo(
            @ApiParam(value = "护理项目ID", required = true)
            @PathVariable Long id
    ) {
        return R.ok(iNursingProjectService.selectNursingProjectById(id));
    }
}
